<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

    <script>

        var arr = [1, 2, 3, 4, 5, 4, 3, 2, 1];

        var everyResult = arr.every(function(item, index, array){
        return item > 2;
        }); 
        // console.log(everyResult);  // false

        var someResult = arr.some(function(item, index, array){
        return item > 2;
        });
        // console.log(someResult);  // true

        var filterResult = arr.filter(function(item, index, array){
        return array.indexOf(item) === index;
        }) 
        // console.log(filterResult);  // [1, 2, 3, 4, 5]

        var mapResult = arr.map(function(item, index, array){
        return item * 2;
        });
        // console.log(mapResult); // [2, 4, 6, 8, 10, 8, 6, 4, 2]

        var sum = arr.reduce(function(prev, cur, index, array){
            return prev + cur;
        });

        console.log(sum);  // 25
       
    </script>
    
</body>
</html>